package cs340.stormtroopers.junitTests.phase4BlackBox;

import junit.framework.*;
import cs340.stormtroopers.hypeerweb.*;


/**
 * Black Box test for the Contents class
 * Tests the functionality of the Contents class
 * 
 * @author Daniel Howard
 */
public class ContentsTest extends TestCase
{
	public static Test suite()
	{
		return new TestSuite(ContentsTest.class);
	}
	
	public ContentsTest()
	{
		super();
	}
	
	public void test()
	{
		Contents contents1 = new Contents();
		Object obj1 = new Object();
		Object obj2 = new Object();
		Object obj3 = new Object();
		contents1.set("A", obj1);
		contents1.set("B", obj2);
		contents1.set("C", obj3);
		Contents contents2 = new Contents(contents1);
		
		assertTrue(contents1.containsKey("A"));
		assertTrue(contents1.containsKey("B"));
		assertTrue(contents1.containsKey("C"));
		assertTrue(contents2.containsKey("A"));
		assertTrue(contents2.containsKey("B"));
		assertTrue(contents2.containsKey("C"));
		
		assertEquals(contents1.get("A"), obj1);
		assertEquals(contents2.get("A"), obj1);
		assertEquals(contents1.get("B"), obj2);
		assertEquals(contents2.get("B"), obj2);
		assertEquals(contents1.get("C"), obj3);
		assertEquals(contents2.get("C"), obj3);
	}
	
	public static void main(String[] args) {
		junit.textui.TestRunner.run(suite());
	}
}
